/* ============================================
   AMI - Base Layout & Theme
   ============================================ */

:root {
    /* Primary Colors */
    --primary: #667eea;
    --primary-dark: #5568d3;
    --primary-light: #7c8ff0;
    --primary-alpha: rgba(102, 126, 234, 0.1);

    /* Background Colors */
    --background: #f7fafc;
    --sidebar-bg: #ffffff;
    --panel-bg: #ffffff;

    /* Text Colors */
    --text: #2d3748;
    --text-light: #718096;
    --text-lighter: #a0aec0;
    --terminal-green: #00ff41;
    --terminal-dim: rgba(0, 255, 65, 0.5);

    /* Border & Divider */
    --border: #e2e8f0;
    --border-light: #edf2f7;

    /* Hex Design System Variables */
    --hex-bg-dark: #020617;
    --hex-matrix-bg: #000000;
    --hex-panel-bg: rgba(30, 41, 59, 0.7);
    --hex-accent: #3b82f6;
    --hex-accent-glow: rgba(59, 130, 246, 0.3);
    --hex-text: #f8fafc;
    --hex-border: 1px solid rgba(148, 163, 184, 0.2);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
}

iframe {
    border: 0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--hex-bg-dark);
    color: var(--hex-text);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

button {
    cursor: pointer;
    border: none;
    outline: none;
    font-family: inherit;
}

/* --- Container & Grid --- */
.ami-container {
    display: grid;
    height: 100vh;
    width: 100vw;
    grid-template-columns: 40% 60%;
    grid-template-rows: 75% 25%;
    grid-template-areas:
        "matrix vis"
        "input input";
    gap: 2px;
    background: #1e293b;
}

/* --- Matrix Shell --- */
.matrix-console {
    grid-area: matrix;
    background-color: var(--hex-matrix-bg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    border-right: var(--hex-border);
}

.matrix-header {
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(255, 255, 255, 0.05);
    border-bottom: var(--hex-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.matrix-title {
    font-family: var(--font-mono);
    color: var(--hex-accent);
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-badge {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid rgba(59, 130, 246, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 10px;
    font-family: var(--font-mono);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--terminal-green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--terminal-green);
    transition: all 0.3s;
}

.status-dot.active {
    background: #FFD700;
    box-shadow: 0 0 12px #FFD700;
    animation: pulse 1s infinite;
}

.status-dot.error {
    background: #ff5555;
    box-shadow: 0 0 12px #ff5555;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.matrix-output {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--terminal-green);
    scroll-behavior: smooth;
    padding-bottom: 60px;
}

.matrix-output::-webkit-scrollbar { width: 6px; }
.matrix-output::-webkit-scrollbar-track { background: #000; }
.matrix-output::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* --- Visualization Deck Shell --- */
.vis-deck {
    grid-area: vis;
    background-color: var(--hex-bg-dark);
    background-image: radial-gradient(circle at 1px 1px, rgba(148, 163, 184, 0.1) 1px, transparent 0);
    background-size: 20px 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
}

.vis-header {
    position: absolute;
    top: 0; left: 0; right: 0;
    padding: var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 10;
    pointer-events: none;
}

/* --- Input Command Shell --- */
.input-command-center {
    grid-area: input;
    background-color: rgba(15, 23, 42, 0.95);
    border-top: var(--hex-border);
    display: flex;
    flex-direction: column;
    padding: var(--spacing-md) var(--spacing-lg);
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.3);
    z-index: 20;
}

.input-wrapper {
    display: flex;
    gap: var(--spacing-md);
    height: 100%;
}

.command-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: var(--spacing-md);
    color: white;
    font-family: var(--font-mono);
    font-size: 14px;
    resize: none;
    transition: all 0.2s;
}

.command-input:focus {
    border-color: var(--hex-accent);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 2px var(--hex-accent-glow);
}

.command-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: space-between;
}

.send-btn {
    width: 60px;
    height: 60px;
    background: var(--hex-accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    transition: all 0.2s;
    clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--hex-accent-glow);
}

.send-btn:disabled {
    background: #334155;
    cursor: wait;
    transform: none;
}

/* --- Canvas & Flex Fill --- */
.visualization-canvas {
    overflow-y: auto;
    height: 100%;
}

#chart-canvas {
    flex: 1;
    width: 100%;
    min-height: 700px;
    min-width: 700px;
}

.viz-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
}
